<html>
<head>
<script>

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

var logDiv;

function log(msg, success)
{
    logDiv.appendChild(document.createElement('div')).textContent = msg + ': ' + (!!success ? 'PASS' : 'FAIL');
}

function clickOn(element)
{
    if (!window.eventSender)
        return;

    var x = element.offsetLeft + element.offsetWidth / 2;
    var y = element.offsetTop + element.offsetHeight / 2;
    eventSender.mouseMoveTo(x, y);
    eventSender.mouseDown();
    eventSender.mouseUp();
}

function runTest()
{
    logDiv = document.getElementById('console');
    var input = document.getElementsByTagName('input')[0];
    setTimeout(function() {
        input.disabled = false;
        if (!window.eventSender)
            return;

        var x = input.offsetLeft + input.offsetWidth / 2;
        var y = input.offsetTop + input.offsetHeight / 2;
        eventSender.mouseMoveTo(x, y);
        eventSender.mouseDown();
        eventSender.mouseUp();
        eventSender.keyDown('a');
        log('The inner text element of the search input should never be 0-height', input.value == 'a');
        testRunner.notifyDone();
    }, 0);
}

</script>
</head>
<body onload="runTest()">
    <div>
        <input id="foo" type="search" disabled>
    </div>
<div id="console">
</div>
</body>
</html>
